<template>
  <div id="shop">
    <HeaderTop />
    <div class="main">
      <div class="category">
        <div class="item-box" v-for="(item,index) in categoryList" :key="index">
          <div class="item" @click="$router.push(`/category/${index}`)">
            <img :src="item.img" alt="">
            <span>{{item.text}}</span>
          </div>
        </div>
      </div>
      <div class="middle">
        <div class="middle-top">
          <i class="van-icon van-icon-volume-o van-notice-bar__left-icon"></i>
          <marquee >公告管理已上线，可点击查看公告列表页，点击列表页公告标题，可查看公告详情</marquee>
          <i class="van-icon van-icon-arrow van-notice-bar__right-icon"></i>
        </div>
        <div class="middle-bottom">
          <div class="class-item" v-for="(items,index) in classList" :key="index">
            <div class="title">{{items[index]['title']}}</div>
              <CartCard  @click.native="$router.push(`/productdetail/${index}`)" v-for="(item,index) in items" :key="index" :item="item" />
              <div class="footer">
                <mt-cell  title="查看更多" >
                  <i class="mint-cell-allow-right"> </i>
                </mt-cell>
              </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import CartCard from '../CartCard/CartCard.vue';
import HeaderTop from "../Header/HeaderTop.vue";
export default {
  components: { HeaderTop, CartCard },
  data(){
    return {
      categoryList:[
        {img:'http://10.203.0.101:8081/shopping/resources/upload/2019-11-11/4962bafffff6d1ebfd1f256fe14ea04a.jpg',text:'电子类'},
        {img:'http://10.203.0.101:8081/shopping/resources/upload/2019-11-11/a4b2ab3d239749a84c9f7e22d4fa1cbe.jpg',text:'男装类'},
        {img:'http://10.203.0.101:8081/shopping/resources/upload/2019-11-11/ec29c2ae5e1061f2215bf4cd4f34dc9e.jpg',text:'水果类'},
        {img:'http://10.203.0.101:8081/shopping/resources/upload/2019-11-11/4962bafffff6d1ebfd1f256fe14ea04a.jpg',text:'电子类'},
        {img:'http://10.203.0.101:8081/shopping/resources/upload/2019-11-11/e00c91a253171c1054eb3cdfa927f3a3.jpg',text:'家具类'},
        {img:'http://10.203.0.101:8081/shopping/resources/upload/2019-11-11/4962bafffff6d1ebfd1f256fe14ea04a.jpg',text:'更多'},
      ],
      classList:[
        [
          {
            title:'水果类',
            img:'http://10.203.0.101:8081/shopping/resources/upload/2ad834a8448d4d839d9f1f64b6ee8fea.jpg',
            text:'【海尔】寻真水果 山东烟台栖霞红富士苹果16-24个 5kg 新鲜水果',
            newPrice:73.5,
            oldPrice:98
          },
          {
            title:'水果类',
            img:'http://10.203.0.101:8081/shopping/resources/upload/f893f1fdc07a48de9db4fa882422c236.jpg',
            text:'【海尔】缤咕果园 海南红心火龙果6斤装约7个大果 红肉吉祥果新鲜水果',
            newPrice:97.5,
            oldPrice:130
          },
          {
            title:'水果类',
            img:'http://10.203.0.101:8081/shopping/resources/upload/64ccd6b3061c4025bc26860171614e78.jpg',
            text:'【海尔】鲜游记 琯溪蜜白肉蜜柚 2个装 约2.5kg 福建平和新鲜柚子',
            newPrice:73.5,
            oldPrice:98
          },
        ],
        [
          {
            title:'蔬菜类',
            img:'http://10.203.0.101:8081/shopping/resources/upload/97812ce7d175451484ce43705ad6d5c3.jpg',
            text:'【海尔】密园小农  密云当地新鲜西红柿 约2kg 自然熟 沙瓤 新鲜蔬菜',
            newPrice:27,
            oldPrice:36
          },
          {
            title:'蔬菜类',
            img:'http://10.203.0.101:8081/shopping/resources/upload/f55b147033d84497a54fd5c34c75e153.jpg',
            text:'【海尔】密园小农 新鲜西兰花 500g  当天采摘蔬菜',
            newPrice:97.5,
            oldPrice:130
          },
          {
            title:'蔬菜类',
            img:'http://10.203.0.101:8081/shopping/resources/upload/64ccd6b3061c4025bc26860171614e78.jpg',
            text:'【海尔】鲜游记 琯溪蜜白肉蜜柚 2个装 约2.5kg 福建平和新鲜柚子',
            newPrice:73.5,
            oldPrice:98
          },
        ],
      ]
    }
  }
};
</script>

<style scoped>
#shop{
  margin-bottom: 6vh;
}

.category{
  display: flex;
  flex-wrap: wrap;
  padding: 10px;
}
.category .item-box{
  padding: 10px;
  width: 26vw;
}
.category .item{
  display: flex;
  flex-direction: column;
  text-align: center;
}
.item img{
  display: inline-block;
  width: 40px;
  height: 40px;
  margin: 2px auto;
}


.middle-top{
    position: relative;
    display: flex;
    color: #ed6a0c;
    background: #fffbe8;
    height: 5vh;
    line-height: 5vh;
}
marquee{
  width: 78%;
  font-size: 14px;
}
.middle-top i{
  width: 10%;
}
.middle-top i:nth-child(1){
  margin-top: 8px;
}


.class-item .title{
    border-top: 1px solid #ddd;
}
.class-item .title{
  text-align: center;
  color: #888;
  margin: 1em auto;
  font-size: 1.4em;
}
.class-item img{
  width: 100%;
  height: 100%;
}
.class-item >>> .mint-cell-title{
  width: 5%;
}
.class-item >>> .mint-cell-value{
  width: 70%;
  margin-right: 10vw;
}

.new-price{
  font-size: 18px;
  color: #1aad19;
}
.old-price{
  text-decoration: line-through;
}


.footer >>> .mint-cell-wrapper{
  position: relative;
}
.footer >>> .mint-cell-text{
  position: absolute;
  left: 42%;
}
</style>